﻿#region Using Declarations

using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

#endregion

namespace Portfolio.Ui.Web.App_Start
{
    public class Bootstrapper
    {
        #region Methods

        #region Initialize

        public static void Initialize()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            RegisterBundles(BundleTable.Bundles);
        }

        #endregion

        #region RegisterRoutes

        private static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Galeria",
                url: "Galeria/{id}",
                defaults: new { controller = "Galeria", action = "Index", id = UrlParameter.Optional }
            );

            routes.MapRoute(
                name: "Fotos",
                url: "Fotos/{id}",
                defaults: new { controller = "Fotos", action = "Index", id = UrlParameter.Optional }
            );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }

        #endregion

        #region RegisterGlobalFilters

        private static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        #endregion

        #region RegisterBundles

        private static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jQuery/jquery-{version}.js",
                        "~/Scripts/jQuery/jquery-ui-{version}.js",
                        "~/Scripts/jQuery/jquery.validate*",
                        "~/Scripts/jQuery/jquery.unobtrusive*",
                        "~/Scripts/Modernizr/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/default").Include(
                        "~/Scripts/Bootstrap/boostrap.min.js",
                        "~/Scripts/Fotorama/fotorama.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                        "~/Content/site.css",
                        "~/Content/Bootstrap/bootstrap.min.cs",
                        "~/Content/Bootstrap/bootstrap-theme.min.cs"));

            bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                        "~/Content/themes/base/jquery.ui.core.css",
                        "~/Content/themes/base/jquery.ui.resizable.css",
                        "~/Content/themes/base/jquery.ui.selectable.css",
                        "~/Content/themes/base/jquery.ui.accordion.css",
                        "~/Content/themes/base/jquery.ui.autocomplete.css",
                        "~/Content/themes/base/jquery.ui.button.css",
                        "~/Content/themes/base/jquery.ui.dialog.css",
                        "~/Content/themes/base/jquery.ui.slider.css",
                        "~/Content/themes/base/jquery.ui.tabs.css",
                        "~/Content/themes/base/jquery.ui.datepicker.css",
                        "~/Content/themes/base/jquery.ui.progressbar.css",
                        "~/Content/themes/base/jquery.ui.theme.css"));
        }

        #endregion

        #endregion
    }
}